package com.topscore.uke.mvp.presenters;

import com.topscore.uke.entities.DistrictBean;
import com.topscore.uke.mvp.contractors.GetDistrictInfoContractor;
import com.topscore.uke.mvp.model.GetDistrictInfoModel;
import com.topscore.uke.network.BaseResponse;

import java.util.List;

/**
 * Created by 71468 on 2017/11/21.
 */

public class GetDistrictInfoPresenter implements GetDistrictInfoContractor, GetDistrictInfoContractor.Presenter {
    private View mView;
    private Model model;
    public GetDistrictInfoPresenter(View view) {
        this.mView = view;
        model = new GetDistrictInfoModel(new CallBack() {


            @Override
            public void onSuccess(BaseResponse<List<DistrictBean>> response) {
                mView.onGetDistrictInfoSuccess(response.getData());
            }

            @Override
            public void onError(int errorCode, String errorMessage) {
                mView.onFail(errorCode,errorMessage);
            }

            @Override
            public void onComplete() {
                mView.onLoadFinished();
            }
        });
    }

    @Override
    public void getDistrictInfo(String cityId) {
        model.getDistrict(cityId);
    }
}
